#ifndef MEGASERIAL_H_e21ff0c2_df36_442d_a2ba_d4fa0c1a135d
#define MEGASERIAL_H_e21ff0c2_df36_442d_a2ba_d4fa0c1a135d

/*
**
** Copyright (c) 2010 by Lorimark Solutions, LLC.
** All Rights Reserved.
** Send inquiries to: info@lorimarksolutions.com
**
*/

#include <evie-systems.h>

#define RX_USART_BUFFER_SIZE            50
#define TX_USART_BUFFER_SIZE            50
#define RX_USART0_INTERRUPT_ENABLE      UCSR0B |=  (1<<RXCIE0 )
#define RX_USART0_INTERRUPT_DISABLE     UCSR0B &= ~(1<<RXCIE0 )

#define TX_USART0_INTERRUPT_ENABLE      UCSR0B |=  (1<<UDRIE0 )
#define TX_USART0_INTERRUPT_DISABLE     UCSR0B &= ~(1<<UDRIE0 )
#define TX_USART0_RUNNING            (( UCSR0A &  ~(1<<TXC0   )) == 0)

#define RX_USART1_INTERRUPT_ENABLE      UCSR1B |=  (1<<RXCIE1 )
#define RX_USART1_INTERRUPT_DISABLE     UCSR1B &= ~(1<<RXCIE1 )

#define TX_USART1_INTERRUPT_ENABLE      UCSR1B |=  (1<<UDRIE1 )
#define TX_USART1_INTERRUPT_DISABLE     UCSR1B &= ~(1<<UDRIE1 )
#define TX_USART1_RUNNING            (( UCSR1A &  ~(1<<TXC1   )) == 0)

void  rxUsartReset( uint8 channel             );
uint8 rxUsartCount( uint8 channel             );
uint8 rxUsartSpace( uint8 channel             );
void  rxUsartPut(   uint8 channel, uint8 data );
uint8 rxUsartGet(   uint8 channel             );
void  txUsartReset( uint8 channel             );
uint8 txUsartCount( uint8 channel             );
uint8 txUsartSpace( uint8 channel             );
void  txUsartPut(   uint8 channel, uint8 data );
uint8 txUsartGet(   uint8 channel             );
void  init_usart(   uint8 channel, uint8 baud );

#endif // MEGASERIAL_C_e21ff0c2_df36_442d_a2ba_d4fa0c1a135d

